package com.seteam.collabcrossword.messages.server;

import com.seteam.collabcrossword.Globals;
import com.seteam.collabcrossword.Tile;
import com.seteam.collabcrossword.messages.Message;

import java.io.Serializable;

/**
 * This message is used to wrap a solution and send it to the client
 */
public class Solution implements Message, Serializable {
    private static final long serialVersionUID = -6451973689140719650L;
    private Object[][] solution;

    /**
     * Constructor
     *
     * @param solution the array of tiles that represents the solution
     */
    public Solution(final Tile[][] solution) {
        this.solution = new Tile[solution.length][solution[0].length];
        this.solution = solution;
    }

    /**
     * Getter for solution
     * @return the array of tiles that represents the solution
     */
    public Tile[][] getSolution() {
        return (Tile[][]) solution;
    }

    /**
     * {@inheritDoc}
     */
    public String getAction() {
        return Globals.SOLUTION;
    }
}
